import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int i = random.nextInt(100);


        int change = 0;
        while (change<7){
            System.out.println("请输入：");
            int cai = scanner.nextInt();
        if (cai>i) {
            System.out.println("大了！");
        } else if (cai < i) {
            System.out.println("小了！");
        } else {
            System.out.println("猜对了！");
            System.out.println("是否重来（0:结束 1:重来）");
            int tf = scanner.nextInt();
            if (tf==1){
                change = 0;
            }else {
                break;
            }

        }
        change++;
        if (change==7){
            System.out.println("是否重来（0:结束 1:重来）");
            int tf = scanner.nextInt();
            if (tf==1){
                change = 0;
            }else {
                break;
            }
        }
        }
        System.out.println("游戏结束");

    }
}
